package com.dangf.service.impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dangf.dao.ArticleDao;
import com.dangf.dao.BaseDao;
import com.dangf.entity.Article;
import com.dangf.service.ArticleService;

@Service
public class ArticleServiceImpl extends BaseServiceImpl<Article> implements ArticleService {
	
	@Resource
	private ArticleDao articleDao;

	
	@Override
	public BaseDao<Article> getDao() {
		// TODO Auto-generated method stub
		return articleDao;
	}


	@Override
	public List<Article> getListByPage(int start, int count) {
		return articleDao.getListByPage(start, count);
	}


	@Override
	public boolean addArticleAndNameToId(Article article) {
		Article a = articleDao.getEntityByParams("title", article.getTitle());
		if(a==null){
			articleDao.save(article);
			System.out.println("采集成功："+article.getTitle());
			return true;
		}
		return false;
	}

}
